<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>上传笔记</title>
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <script src="/js/jquery-3.6.0.min.js"></script>
    <style>
        #login {
            width: 300px;

            margin: 100px auto;

        }

        #login .btn {
            margin: 20px 100px;
        }
    </style>
</head>

<body>
    <div id="black"><a href="/"><img src="/black.png"></a></div>
    <div id="login">
        <input type="password" class="form-control" placeholder="Password" name="pas" id="">
        <input type="submit" class="btn btn-default" value="登入">
    </div>

    <script>
        $('.btn').on('click', () => {
            let pwd = $('.form-control').val();
            $.ajax({
                url: '/api/login',
                type: 'post',
                data: { pwd },
                success: function (data) {
                    let { err,msg } = data;

                    if(!err){
                        $('body').html(data);
                    }
                    else{
                        alert(msg);
                    }
                }
            })
        })

    </script>
</body>

</html>